<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    div{
      width: 300px;
      background-color: rgba(0,0,0,0.3);
      padding: 10px;
      position: relative;/*做参照物*/
    }
    input{border: 0;padding: 10px 20px;width: 260px;}
    img{
      position: absolute;
      top: 14px;
      right: 30px;
    }
    p{font-size: 12px;color: red;margin: 0;}

  </style>
</head>
<body>
<div>
  <input type="text" placeholder="请输入用户名">
  <img src="yhm.png">
  <p>用户名不能为空!</p>
</div>
</body>
</html>